home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Games / Hexagonal CA / HexCA.c / DrawGridUtil.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-28  |  16.5 KB  |  566 lines  |  [TEXT/CWIE]

  1. #include "AppConstants.h"
  2. #include "AppMacros.h"
  3. #include "AppTypes.h"
  4. #include "AppGlobals.h"
  5. #include "GridCopyPr.h"
  6. #include "NumberStringUtilPr.h"
  7. #include "ToolTrapsPr.h"
  8.  
  9. #include "DrawGridUtilPr.h"
  10.  
  11. static void    drawHexCell        ( register unsigned char *, register long );
  12. static void    eraseHexCell        ( register unsigned char *, register long );
  13. static void    drawHexCellMini    ( register unsigned char *, register long );
  14. static void    eraseHexCellMini    ( register unsigned char *, register long );
  15. static void    drawHexCellTiny    (register unsigned char *, register long );
  16. static void    eraseHexCellTiny    ( register unsigned char *, register long );
  17.  
  18. // drawHexGrid -    call to draw the entire hex grid of the given window
  19. void drawHexGrid( WindowRef theWindow )
  20. {
  21.     register GridDataPtr        refCon = (GridDataPtr)MGetWRefCon( theWindow );
  22.     register unsigned char    **position = refCon->position;
  23.     register long            count, total = refCon->gridTotalSize;
  24.     register Boolean        *oldGrid = refCon->oldGrid;
  25.     CGrafPtr                saveCPort = nil;
  26.     GDHandle                saveGDevice = nil;
  27.     register long            rowLength = refCon->rowBytes;
  28.         
  29.     GetGWorld( &saveCPort, &saveGDevice );
  30.     SetGWorld( refCon->theGWorld, nil );
  31.     MEraseRect( &refCon->theGWorld->portRect );
  32.     
  33.     // draw the grid - depends on which hexagon size of being used
  34.     if( refCon->scale == kHexSize )
  35.     {
  36.         // 16x16
  37.         for( count = 0; count < total; count++, position++ )
  38.             if( *oldGrid++ )
  39.                 drawHexCell( *position, rowLength );
  40.     }
  41.     else if( refCon->scale == kMiniHexSize )
  42.     {
  43.         // 8x8
  44.         for( count = 0; count < total; count++, position++ )
  45.             if( *oldGrid++ )
  46.                 drawHexCellMini( *position, rowLength );
  47.     }
  48.     else
  49.     {
  50.         // 4x4
  51.         for( count = 0; count < total; count++, position++ )
  52.             if( *oldGrid++ )
  53.                 drawHexCellTiny( *position, rowLength );
  54.     }
  55.  
  56.     // draw the iteration number
  57.     if( refCon->drawIteration )
  58.     {
  59.         Rect        theRect;
  60.         
  61.         MSetRect( theRect, 5, 3, 100, 13 );
  62.         MEraseRect( &theRect );
  63.         MMoveTo( 5, 12 );
  64.         MDrawString( "\pIteration: " );
  65.         MDrawString( refCon->iterationString );
  66.     }
  67.  
  68.     SetGWorld( saveCPort, saveGDevice );
  69. }
  70.  
  71. // calculateNextIteration -    call to calculate the next iteration
  72. void calculateNextIteration( WindowRef theWindow )
  73. {
  74.     GridDataPtr            refCon = (GridDataPtr)MGetWRefCon( theWindow );
  75.     unsigned char            **position = refCon->position;
  76.     register long            count, total = refCon->gridTotalSize;
  77.     register Boolean        *newGrid = refCon->newGrid, *oldGrid = refCon->oldGrid;
  78.     Boolean                *alive = refCon->alive, *dead = refCon->dead;
  79.     register NeighbourPtr    neighbourPtr = refCon->neighbours;
  80.     register long            rowLength = refCon->rowBytes;
  81.         
  82.     // calculate the new grid - drawing depends on which scale is being used
  83.     if( refCon->scale == kHexSize )
  84.     {
  85.         // calculate the next iteration and draw using normal hex cells (16x16)
  86.         for( count = 0; count < total; count++, position++, neighbourPtr++ )
  87.         {
  88.             register unsigned char    neighbours = *(neighbourPtr->neighbour[0]);
  89.             
  90.             // get the total number of alive neighbours
  91.             neighbours += *(neighbourPtr->neighbour[1]);
  92.             neighbours += *(neighbourPtr->neighbour[2]);
  93.             neighbours += *(neighbourPtr->neighbour[3]);
  94.             neighbours += *(neighbourPtr->neighbour[4]);
  95.             neighbours += *(neighbourPtr->neighbour[5]);
  96.                         
  97.             // depending on the cell's old state, calculate the new state depending on the number of neighbours
  98.             if( *oldGrid++ )
  99.             {
  100.                 if( !(*newGrid++ = alive[neighbours]) )
  101.                     eraseHexCell( *position, rowLength );
  102.             }
  103.             else
  104.                 if( *newGrid++ = dead[neighbours] )
  105.                     drawHexCell( *position, rowLength );
  106.         }
  107.     }
  108.     else if( refCon->scale == kMiniHexSize )
  109.     {
  110.         // calculate the next iteration and draw using mini hex cells (8x8)
  111.         for( count = 0; count < total; count++, position++, neighbourPtr++ )
  112.         {
  113.             register unsigned char    neighbours = *(neighbourPtr->neighbour[0]);
  114.             
  115.             // get the total number of alive neighbours
  116.             neighbours += *(neighbourPtr->neighbour[1]);
  117.             neighbours += *(neighbourPtr->neighbour[2]);
  118.             neighbours += *(neighbourPtr->neighbour[3]);
  119.             neighbours += *(neighbourPtr->neighbour[4]);
  120.             neighbours += *(neighbourPtr->neighbour[5]);
  121.                         
  122.             // depending on the cell's old state, calculate the new state depending on the number of neighbours
  123.             if( *oldGrid++ )
  124.             {
  125.                 if( !(*newGrid++ = alive[neighbours]) )
  126.                     eraseHexCellMini( *position, rowLength );
  127.             }
  128.             else
  129.                 if( *newGrid++ = dead[neighbours] )
  130.                     drawHexCellMini( *position, rowLength );
  131.         }
  132.     }
  133.     else
  134.     {
  135.         // calculate the next iteration and draw using tiny hex cells (4x4)
  136.         for( count = 0; count < total; count++, position++, neighbourPtr++ )
  137.         {
  138.             register unsigned char    neighbours = *(neighbourPtr->neighbour[0]);
  139.             
  140.             // get the total number of alive neighbours
  141.             neighbours += *(neighbourPtr->neighbour[1]);
  142.             neighbours += *(neighbourPtr->neighbour[2]);
  143.             neighbours += *(neighbourPtr->neighbour[3]);
  144.             neighbours += *(neighbourPtr->neighbour[4]);
  145.             neighbours += *(neighbourPtr->neighbour[5]);
  146.                         
  147.             // depending on the cell's old state, calculate the new state depending on the number of neighbours
  148.             if( *oldGrid++ )
  149.             {
  150.                 if( !(*newGrid++ = alive[neighbours]) )
  151.                     eraseHexCellTiny( *position, rowLength );
  152.             }
  153.             else
  154.                 if( *newGrid++ = dead[neighbours] )
  155.                     drawHexCellTiny( *position, rowLength );
  156.         }
  157.     }
  158.         
  159.     // draw the iteration number
  160.     if( refCon->drawIteration )
  161.     {
  162.         Rect            theRect;
  163.         CGrafPtr        saveCPort = nil;
  164.         GDHandle        saveGDevice = nil;
  165.         
  166.         GetGWorld( &saveCPort, &saveGDevice );
  167.         SetGWorld( refCon->theGWorld, nil );
  168.         MSetRect( theRect, 5, 3, 100, 13 );
  169.         MEraseRect( &theRect );
  170.         MMoveTo( 5, 12 );
  171.         Add1ToString( refCon->iterationString );
  172.         MDrawString( "\pIteration: " );
  173.         MDrawString( refCon->iterationString );
  174.         SetGWorld( saveCPort, saveGDevice );
  175.     }
  176.     
  177.     // copy the new grid over the old grid
  178.     RBlockMove( (Ptr)refCon->newGrid, (Ptr)refCon->oldGrid, refCon->gridMove );
  179. }
  180.  
  181. // drawHexCell -    call to draw a 16x16 hexagonal cell in the given PixMap
  182. static void drawHexCell( register unsigned char *startAddr, register long rowLength )
  183. {    
  184.     *((long *)(startAddr + 6)) = kTileEndLong;
  185.     startAddr += rowLength;
  186. //#ifndef powerc
  187.     *((long *)(startAddr + 4)) = kTileColorLong;
  188.     *((long *)(startAddr + 8)) = kTileEndLong;
  189. //#else
  190. //    *((double *)(startAddr + 4)) = kTileEndDouble;
  191. //#endif
  192.     startAddr += rowLength;
  193. //#ifndef powerc
  194.     *((long *)(startAddr + 2)) = kTileColorLong;
  195.     *((long *)(startAddr + 6)) = kTileColorLong;
  196.     *((long *)(startAddr + 10)) = kTileEndLong;
  197. //#else
  198. //    *((double *)(startAddr + 2)) = kTileColorDouble;
  199. //    *((long *)(startAddr + 10)) = kTileEndLong;
  200. //#endif
  201.     startAddr += rowLength;
  202. //#ifndef powerc
  203.     *((long *)startAddr) = kTileColorLong;
  204.     *((long *)(startAddr + 4)) = kTileColorLong;
  205.     *((long *)(startAddr + 8)) = kTileColorLong;
  206.     *((long *)(startAddr + 12)) = kTileEndLong;
  207. //#else
  208. //    *((double *)startAddr) = kTileColorDouble;
  209. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  210. //#endif
  211.     startAddr += rowLength;
  212. //#ifndef powerc
  213.     *((long *)startAddr) = kTileColorLong;
  214.     *((long *)(startAddr + 4)) = kTileColorLong;
  215.     *((long *)(startAddr + 8)) = kTileColorLong;
  216.     *((long *)(startAddr + 12)) = kTileEndLong;
  217. //#else
  218. //    *((double *)startAddr) = kTileColorDouble;
  219. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  220. //#endif
  221.     startAddr += rowLength;
  222. //#ifndef powerc
  223.     *((long *)startAddr) = kTileColorLong;
  224.     *((long *)(startAddr + 4)) = kTileColorLong;
  225.     *((long *)(startAddr + 8)) = kTileColorLong;
  226.     *((long *)(startAddr + 12)) = kTileEndLong;
  227. //#else
  228. //    *((double *)startAddr) = kTileColorDouble;
  229. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  230. //#endif
  231.     startAddr += rowLength;
  232. //#ifndef powerc
  233.     *((long *)startAddr) = kTileColorLong;
  234.     *((long *)(startAddr + 4)) = kTileColorLong;
  235.     *((long *)(startAddr + 8)) = kTileColorLong;
  236.     *((long *)(startAddr + 12)) = kTileEndLong;
  237. //#else
  238. //    *((double *)startAddr) = kTileColorDouble;
  239. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  240. //#endif
  241.     startAddr += rowLength;
  242. //#ifndef powerc
  243.     *((long *)startAddr) = kTileColorLong;
  244.     *((long *)(startAddr + 4)) = kTileColorLong;
  245.     *((long *)(startAddr + 8)) = kTileColorLong;
  246.     *((long *)(startAddr + 12)) = kTileEndLong;
  247. //#else
  248. //    *((double *)startAddr) = kTileColorDouble;
  249. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  250. //#endif
  251.     startAddr += rowLength;
  252. //#ifndef powerc
  253.     *((long *)startAddr) = kTileColorLong;
  254.     *((long *)(startAddr + 4)) = kTileColorLong;
  255.     *((long *)(startAddr + 8)) = kTileColorLong;
  256.     *((long *)(startAddr + 12)) = kTileEndLong;
  257. //#else
  258. //    *((double *)startAddr) = kTileColorDouble;
  259. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  260. //#endif
  261.     startAddr += rowLength;
  262. //#ifndef powerc
  263.     *((long *)startAddr) = kTileColorLong;
  264.     *((long *)(startAddr + 4)) = kTileColorLong;
  265.     *((long *)(startAddr + 8)) = kTileColorLong;
  266.     *((long *)(startAddr + 12)) = kTileEndLong;
  267. //#else
  268. //    *((double *)startAddr) = kTileColorDouble;
  269. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  270. //#endif
  271.     startAddr += rowLength;
  272. //#ifndef powerc
  273.     *((long *)startAddr) = kTileColorLong;
  274.     *((long *)(startAddr + 4)) = kTileColorLong;
  275.     *((long *)(startAddr + 8)) = kTileColorLong;
  276.     *((long *)(startAddr + 12)) = kTileEndLong;
  277. //#else
  278. //    *((double *)startAddr) = kTileColorDouble;
  279. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  280. //#endif
  281.     startAddr += rowLength;
  282. //#ifndef powerc
  283.     *((long *)startAddr) = kTileColorLong;
  284.     *((long *)(startAddr + 4)) = kTileColorLong;
  285.     *((long *)(startAddr + 8)) = kTileColorLong;
  286.     *((long *)(startAddr + 12)) = kTileEndLong;
  287. //#else
  288. //    *((double *)startAddr) = kTileColorDouble;
  289. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  290. //#endif
  291.     startAddr += rowLength;
  292. //#ifndef powerc
  293.     *((long *)startAddr) = kTileColorLong;
  294.     *((long *)(startAddr + 4)) = kTileColorLong;
  295.     *((long *)(startAddr + 8)) = kTileColorLong;
  296.     *((long *)(startAddr + 12)) = kTileEndLong;
  297. //#else
  298. //    *((double *)startAddr) = kTileColorDouble;
  299. //    *((double *)(startAddr + 8)) = kTileEndDouble;
  300. //#endif
  301.     startAddr += rowLength;
  302. //#ifndef powerc
  303.     *((long *)(startAddr + 2)) = kTileColorLong;
  304.     *((long *)(startAddr + 6)) = kTileColorLong;
  305.     *((long *)(startAddr + 10)) = kTileEndLong;
  306. //#else
  307. //    *((double *)(startAddr + 2)) = kTileColorDouble;
  308. //    *((long *)(startAddr + 10)) = kTileEndLong;
  309. //#endif
  310.     startAddr += rowLength;
  311. //#ifndef powerc
  312.     *((long *)(startAddr + 4)) = kTileColorLong;
  313.     *((long *)(startAddr + 8)) = kTileEndLong;
  314. //#else
  315. //    *((double *)(startAddr + 4)) = kTileEndDouble;
  316. //#endif
  317.     *((long *)(startAddr + rowLength + 6)) = kTileEndLong;
  318. }
  319.  
  320. // eraseHexCell -    call to erase a 16x16 hexagonal cell in the given PixMap
  321. static void eraseHexCell( register unsigned char *startAddr, register long rowLength )
  322. {
  323.     *((long *)(startAddr + 6)) = 0;
  324.     startAddr += rowLength;
  325. #ifndef powerc
  326.     *((long *)(startAddr + 4)) = 0;
  327.     *((long *)(startAddr + 8)) = 0;
  328. #else
  329.     *((double *)(startAddr + 4)) = 0;
  330. #endif
  331.     startAddr += rowLength;
  332. #ifndef powerc
  333.     *((long *)(startAddr + 2)) = 0;
  334.     *((long *)(startAddr + 6)) = 0;
  335.     *((long *)(startAddr + 10)) = 0;
  336. #else
  337.     *((double *)(startAddr + 2)) = 0;
  338.     *((long *)(startAddr + 10)) = 0;
  339. #endif
  340.     startAddr += rowLength;
  341. #ifndef powerc
  342.     *((long *)startAddr) = 0;
  343.     *((long *)(startAddr + 4)) = 0;
  344.     *((long *)(startAddr + 8)) = 0;
  345.     *((long *)(startAddr + 12)) = 0;
  346. #else
  347.     *((double *)startAddr) = 0;
  348.     *((double *)(startAddr + 8)) = 0;
  349. #endif
  350.     startAddr += rowLength;
  351. #ifndef powerc
  352.     *((long *)startAddr) = 0;
  353.     *((long *)(startAddr + 4)) = 0;
  354.     *((long *)(startAddr + 8)) = 0;
  355.     *((long *)(startAddr + 12)) = 0;
  356. #else
  357.     *((double *)startAddr) = 0;
  358.     *((double *)(startAddr + 8)) = 0;
  359. #endif
  360.     startAddr += rowLength;
  361. #ifndef powerc
  362.     *((long *)startAddr) = 0;
  363.     *((long *)(startAddr + 4)) = 0;
  364.     *((long *)(startAddr + 8)) = 0;
  365.     *((long *)(startAddr + 12)) = 0;
  366. #else
  367.     *((double *)startAddr) = 0;
  368.     *((double *)(startAddr + 8)) = 0;
  369. #endif
  370.     startAddr += rowLength;
  371. #ifndef powerc
  372.     *((long *)startAddr) = 0;
  373.     *((long *)(startAddr + 4)) = 0;
  374.     *((long *)(startAddr + 8)) = 0;
  375.     *((long *)(startAddr + 12)) = 0;
  376. #else
  377.     *((double *)startAddr) = 0;
  378.     *((double *)(startAddr + 8)) = 0;
  379. #endif
  380.     startAddr += rowLength;
  381. #ifndef powerc
  382.     *((long *)startAddr) = 0;
  383.     *((long *)(startAddr + 4)) = 0;
  384.     *((long *)(startAddr + 8)) = 0;
  385.     *((long *)(startAddr + 12)) = 0;
  386. #else
  387.     *((double *)startAddr) = 0;
  388.     *((double *)(startAddr + 8)) = 0;
  389. #endif
  390.     startAddr += rowLength;
  391. #ifndef powerc
  392.     *((long *)startAddr) = 0;
  393.     *((long *)(startAddr + 4)) = 0;
  394.     *((long *)(startAddr + 8)) = 0;
  395.     *((long *)(startAddr + 12)) = 0;
  396. #else
  397.     *((double *)startAddr) = 0;
  398.     *((double *)(startAddr + 8)) = 0;
  399. #endif
  400.     startAddr += rowLength;
  401. #ifndef powerc
  402.     *((long *)startAddr) = 0;
  403.     *((long *)(startAddr + 4)) = 0;
  404.     *((long *)(startAddr + 8)) = 0;
  405.     *((long *)(startAddr + 12)) = 0;
  406. #else
  407.     *((double *)startAddr) = 0;
  408.     *((double *)(startAddr + 8)) = 0;
  409. #endif
  410.     startAddr += rowLength;
  411. #ifndef powerc
  412.     *((long *)startAddr) = 0;
  413.     *((long *)(startAddr + 4)) = 0;
  414.     *((long *)(startAddr + 8)) = 0;
  415.     *((long *)(startAddr + 12)) = 0;
  416. #else
  417.     *((double *)startAddr) = 0;
  418.     *((double *)(startAddr + 8)) = 0;
  419. #endif
  420.     startAddr += rowLength;
  421. #ifndef powerc
  422.     *((long *)startAddr) = 0;
  423.     *((long *)(startAddr + 4)) = 0;
  424.     *((long *)(startAddr + 8)) = 0;
  425.     *((long *)(startAddr + 12)) = 0;
  426. #else
  427.     *((double *)startAddr) = 0;
  428.     *((double *)(startAddr + 8)) = 0;
  429. #endif
  430.     startAddr += rowLength;
  431. #ifndef powerc
  432.     *((long *)startAddr) = 0;
  433.     *((long *)(startAddr + 4)) = 0;
  434.     *((long *)(startAddr + 8)) = 0;
  435.     *((long *)(startAddr + 12)) = 0;
  436. #else
  437.     *((double *)startAddr) = 0;
  438.     *((double *)(startAddr + 8)) = 0;
  439. #endif
  440.     startAddr += rowLength;
  441. #ifndef powerc
  442.     *((long *)(startAddr + 2)) = 0;
  443.     *((long *)(startAddr + 6)) = 0;
  444.     *((long *)(startAddr + 10)) = 0;
  445. #else
  446.     *((double *)(startAddr + 2)) = 0;
  447.     *((long *)(startAddr + 10)) = 0;
  448. #endif
  449.     startAddr += rowLength;
  450. #ifndef powerc
  451.     *((long *)(startAddr + 4)) = 0;
  452.     *((long *)(startAddr + 8)) = 0;
  453. #else
  454.     *((double *)(startAddr + 4)) = 0;
  455. #endif
  456.     *((long *)(startAddr + rowLength + 6)) = 0;
  457. }
  458.  
  459. // drawHexCellMini -    call to draw a 8x8 mini hexagonal cell in the given PixMap
  460. static void drawHexCellMini( register unsigned char *startAddr, register long rowLength )
  461. {
  462.     *(startAddr + 3) = kTileColorChar;
  463.     startAddr += rowLength;
  464.     *((long *)(startAddr + 1)) = kTileColorLong;
  465.     *(startAddr + 5) = kTileColorChar;
  466.     startAddr += rowLength;
  467. //#ifndef powerc
  468.     *((long *)startAddr) = kTileColorLong;
  469.     *((long *)(startAddr + 4)) = kTileEndLong;
  470. //#else
  471. //    *((double *)startAddr) = kTileEndLong;
  472. //#endif
  473.     startAddr += rowLength;
  474. //#ifndef powerc
  475.     *((long *)startAddr) = kTileColorLong;
  476.     *((long *)(startAddr + 4)) = kTileEndLong;
  477. //#else
  478. //    *((double *)startAddr) = kTileEndLong;
  479. //#endif
  480.     startAddr += rowLength;
  481. //#ifndef powerc
  482.     *((long *)startAddr) = kTileColorLong;
  483.     *((long *)(startAddr + 4)) = kTileEndLong;
  484. //#else
  485. //    *((double *)startAddr) = kTileEndLong;
  486. //#endif
  487.     startAddr += rowLength;
  488. //#ifndef powerc
  489.     *((long *)startAddr) = kTileColorLong;
  490.     *((long *)(startAddr + 4)) = kTileEndLong;
  491. //#else
  492. //    *((double *)startAddr) = kTileEndLong;
  493. //#endif
  494.     startAddr += rowLength;
  495.     *((long *)(startAddr + 1)) = kTileColorLong;
  496.     *(startAddr + 5) = kTileColorChar;
  497.     startAddr += rowLength;
  498.     *(startAddr + 3) = kTileColorChar;
  499. }
  500.  
  501. // eraseHexCellMini -    call to erase a 8x8 mini hexagonal cell in the given PixMap
  502. static void eraseHexCellMini( register unsigned char *startAddr, register long rowLength )
  503. {
  504.     *(startAddr + 3) = 0;
  505.     startAddr += rowLength;
  506.     *((long *)(startAddr + 1)) = 0;
  507.     *(startAddr + 5) = 0;
  508.     startAddr += rowLength;
  509. #ifndef powerc
  510.     *((long *)startAddr) = 0;
  511.     *((long *)(startAddr + 4)) = 0;
  512. #else
  513.     *((double *)startAddr) = 0;
  514. #endif
  515.     startAddr += rowLength;
  516. #ifndef powerc
  517.     *((long *)startAddr) = 0;
  518.     *((long *)(startAddr + 4)) = 0;
  519. #else
  520.     *((double *)startAddr) = 0;
  521. #endif
  522.     startAddr += rowLength;
  523. #ifndef powerc
  524.     *((long *)startAddr) = 0;
  525.     *((long *)(startAddr + 4)) = 0;
  526. #else
  527.     *((double *)startAddr) = 0;
  528. #endif
  529.     startAddr += rowLength;
  530. #ifndef powerc
  531.     *((long *)startAddr) = 0;
  532.     *((long *)(startAddr + 4)) = 0;
  533. #else
  534.     *((double *)startAddr) = 0;
  535. #endif
  536.     startAddr += rowLength;
  537.     *((long *)(startAddr + 1)) = 0;
  538.     *(startAddr + 5) = 0;
  539.     startAddr += rowLength;
  540.     *(startAddr + 3) = 0;
  541. }
  542.  
  543. // drawHexCellTiny -    call to draw a 4x4 tiny hexagonal cell in the given PixMap
  544. static void drawHexCellTiny( register unsigned char *startAddr, register long rowLength )
  545. {
  546.     *((short *)(startAddr + 1)) = kTileColorShort;
  547.     startAddr += rowLength;
  548.     *((long *)startAddr) = kTileColorLong;
  549.     startAddr += rowLength;
  550.     *((long *)startAddr) = kTileColorLong;
  551.     startAddr += rowLength;
  552.     *((short *)(startAddr + 1)) = kTileColorShort;
  553. }
  554.  
  555. // eraseHexCellTiny -    call to erase a 4x4 tiny hexagonal cell in the given PixMap
  556. static void eraseHexCellTiny( register unsigned char *startAddr, register long rowLength )
  557. {
  558.     *((short *)(startAddr + 1)) = 0;
  559.     startAddr += rowLength;
  560.     *((long *)startAddr) = 0;
  561.     startAddr += rowLength;
  562.     *((long *)startAddr) = 0;
  563.     startAddr += rowLength;
  564.     *((short *)(startAddr + 1)) = 0;
  565. }
  566.